<?php
$tot_religion = 0;
$tot_race = 0;
$tot_sex = 0;
$tot_age = 0;

for($i=0; $i<count($stat_arr); $i++){
	if($stat_arr[$i]['populationcatdesc'] == "buddhist")
		$buddhist = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "catholic")
		$catholic = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "islam")
		$islam = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "hindu")
		$hindu = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "other_rel")
		$other_rel = $stat_arr[$i]['TOTALCOUNT'];	
	if($stat_arr[$i]['populationcatdesc'] == "sinhalese")
		$sinhalese = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "srilankan_tamil")
		$srilankan_tamil = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "indian_tamil")
		$indian_tamil = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "muslim")
		$muslim = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "other_nat")
		$other_nat = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "male")
		$male = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "female")
		$female = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "age_1_16")
		$age_1_16 = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "age_16_30")
		$age_16_30 = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "age_30_50")
		$age_30_50 = $stat_arr[$i]['TOTALCOUNT'];
	if($stat_arr[$i]['populationcatdesc'] == "age_50")
		$age_50 = $stat_arr[$i]['TOTALCOUNT'];	

	/*$tot_religion = $buddhist + $catholic + $islam + $hindu + $other_rel;
	$tot_race = $sinhalese + $srilankan_tamil + $indian_tamil + $muslim + $other_nat;
	$tot_sex = $male + $female;
	$tot_age = $age_1_16 + $age_16_30 + $age_30_50 + $age_50;*/
}

?>
<!-- udapalatha pie chart -->
<script type="text/javascript">
	google.load("visualization", "1", {packages:["corechart"]});
	google.setOnLoadCallback(drawVisualization);
	function drawVisualization() {
		var data = google.visualization.arrayToDataTable([
		    	['Religion', 'Statistics'],
			['Buddhist',  <?php echo $buddhist; ?>],
			['Catholic',  <?php echo $catholic; ?>],
			['Islam', <?php echo $islam; ?>],
			['Hindu', <?php echo $hindu; ?>],
			['Other', <?php echo $other_rel; ?>]
		]);

		var options = {
			'legend': 'right',
			'title' : 'Gampola Statistics - Religions',
			'is3D' : true
		};

		var chart1 = new google.visualization.PieChart(document.getElementById('chart_rel'));
		chart1.draw(data, options);
	}
</script>
<script type="text/javascript">
	google.load("visualization", "1", {packages:["corechart"]});
	google.setOnLoadCallback(drawVisualization);
	function drawVisualization() {
		var data = google.visualization.arrayToDataTable([
		    	['Race', 'Statistics'],
			['Sinhalese',  <?php echo $sinhalese; ?>],
			['Sri Lankan Tamil',  <?php echo $srilankan_tamil; ?>],
			['Indian Tamil', <?php echo $indian_tamil; ?>],
			['Muslim', <?php echo $muslim; ?>],
			['Other', <?php echo $other_nat; ?>]
		]);

		var options = {
			'legend': 'right',
			'title' : 'Gampola Statistics - Races',
			'is3D' : true
		};

		var chart2 = new google.visualization.PieChart(document.getElementById('chart_race'));
		chart2.draw(data, options);
	}
</script>
<script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
		['Age', 'Statistics'],
		['1 to 16',  <?php echo $age_1_16; ?>],
		['16 to 30',  <?php echo $age_16_30; ?>],
		['30 to 50', <?php echo $age_30_50; ?>],
		['50 or above', <?php echo $age_50; ?>]
        ]);

        var options = {
		'legend': 'right',
		'title' : 'Gampola Statistics - Ages',
		'is3D' : true
		};

        var chart3 = new google.visualization.PieChart(document.getElementById('chart_age'));
        chart3.draw(data, options);
      }
    </script>

<!-- Page Navigation end-->

<h2>Dashboard</h2>

<!-- #featured section start -->
<div id="featured">
    <div>
        <iframe width="690" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" class="gampolamap" src="https://maps.google.com/maps?hl=en&amp;q=Gampola,+Kandy,+Central+Province,+Sri+Lanka&amp;ie=UTF8&amp;geocode=FTJTbQAdm4DNBA&amp;split=0&amp;sll=37.0625,-95.677068&amp;sspn=23.875,57.630033&amp;hq=&amp;hnear=Gampola,+Kandy,+Central+Province,+Sri+Lanka&amp;t=m&amp;source=embed&amp;ll=7.164682,80.576563&amp;spn=0.136427,0.261612&amp;z=13&amp;output=embed"></iframe><br />
        <small><a href="https://maps.google.com/maps?hl=en&amp;q=Gampola,+Kandy,+Central+Province,+Sri+Lanka&amp;ie=UTF8&amp;geocode=FTJTbQAdm4DNBA&amp;split=0&amp;sll=37.0625,-95.677068&amp;sspn=23.875,57.630033&amp;hq=&amp;hnear=Gampola,+Kandy,+Central+Province,+Sri+Lanka&amp;t=m&amp;source=embed&amp;ll=7.164682,80.576563&amp;spn=0.136427,0.261612&amp;z=13" style="color:#999999;text-align:left; font-family:Arial, Helvetica, sans-serif; font-size:11px; margin:0 0 0 14px;">View Larger Map</a></small>
    </div>
    <div>
        <!--<h3 style="margin-bottom:12px;">Gampola <a href="<?php echo base_url(); ?>about/aboutgampola">General information</a></h3>--><h3 style="margin-bottom:12px;">GAMPOLA STATISTICS</h3>
        <!--<p><img src="<?php echo base_url(); ?>images/gampola-map.png" width="190" class="left-align" style="border:5px solid #868593;" alt=""/>You can remove any link to our website from this website template, you're free to use this website template without linking back to us. <br/><br/> If you're having problems editing this website template, then don't hesitate to ask for help on the You can remove any link to our website from this website template, you're free to use this website template without linking back to us.. 	<a href="#">read more</a>-->
    </div>

</div><!-- #featured section end -->

<!-- .article section Start -->
    <div class="article">

        <!-- Udapalatha / Doluwa view details section Start -->
        <div class="news">
            <div class="section-01 st">
                <div id="chart_rel" class="stat_charts" style="width: 600px; height: 350px;"></div>
		<div id="chart_race" class="stat_charts" style="width: 600px; height: 350px;"></div>
		<div id="chart_age" class="stat_charts" style="width: 600px; height: 350px;"></div>
            </div>

        </div><!-- Udapalatha / Doluwa view details section End -->
</div>
        
